package com.ruoyi.process.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.process.domain.UnqualifyHandle;
import com.ruoyi.process.mapper.UnqualifyHandleMapper;
import com.ruoyi.process.service.IUnqualifyHandleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 不合格食品处置Service业务层处理
 *
 * @author wng
 * @date 2024-08-04
 */
@Service
public class UnqualifyHandleServiceImpl implements IUnqualifyHandleService {
    @Resource
    private UnqualifyHandleMapper unqualifyHandleMapper;

    /**
     * 查询不合格食品处置
     *
     * @param id 不合格食品处置主键
     * @return 不合格食品处置
     */
    @Override
    public UnqualifyHandle selectUnqualifyHandleById(Long id) {
        return unqualifyHandleMapper.selectUnqualifyHandleById(id);
    }

    /**
     * 查询不合格食品处置列表
     *
     * @param unqualifyHandle 不合格食品处置
     * @return 不合格食品处置
     */
    @Override
    public List<UnqualifyHandle> selectUnqualifyHandleList(UnqualifyHandle unqualifyHandle) {
        return unqualifyHandleMapper.selectUnqualifyHandleList(unqualifyHandle);
    }

    /**
     * 新增不合格食品处置
     *
     * @param unqualifyHandle 不合格食品处置
     * @return 结果
     */
    @Override
    public int insertUnqualifyHandle(UnqualifyHandle unqualifyHandle) {
        unqualifyHandle.setCreateTime(DateUtils.getNowDate());
        return unqualifyHandleMapper.insertUnqualifyHandle(unqualifyHandle);
    }

    /**
     * 修改不合格食品处置
     *
     * @param unqualifyHandle 不合格食品处置
     * @return 结果
     */
    @Override
    public int updateUnqualifyHandle(UnqualifyHandle unqualifyHandle) {
        unqualifyHandle.setUpdateTime(DateUtils.getNowDate());
        return unqualifyHandleMapper.updateUnqualifyHandle(unqualifyHandle);
    }

    /**
     * 批量删除不合格食品处置
     *
     * @param ids 需要删除的不合格食品处置主键
     * @return 结果
     */
    @Override
    public int deleteUnqualifyHandleByIds(Long[] ids) {
        return unqualifyHandleMapper.deleteUnqualifyHandleByIds(ids);
    }

    /**
     * 删除不合格食品处置信息
     *
     * @param id 不合格食品处置主键
     * @return 结果
     */
    @Override
    public int deleteUnqualifyHandleById(Long id) {
        return unqualifyHandleMapper.deleteUnqualifyHandleById(id);
    }
}
